package com.pro.service.impl;

import com.pro.entry.JsActicleCategroy;
import com.pro.mapper.JsActicleCategroyMapper;
import com.pro.service.JsActicleCategroyService;
import com.pro.utils.RedisCacheUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName:JsActicleCategroyServiceImple
 * Package:com.pro.service.impl
 * Description:
 *
 * @Date:2022/4/8 8:45
 * @Author: ZPT
 */
@Service
public class JsActicleCategroyServiceImple implements JsActicleCategroyService {

    @Autowired(required = false)
    private JsActicleCategroyMapper categroyMapper;
    @Autowired
    private RedisCacheUtil redisCacheUtil;

    /**
     * @author ZPT
     * @content :微圈分类列表
     */
    @Override
    public List<JsActicleCategroy> getActicleCategroy() {
        //从缓存中获取微圈分类
       /* List<JsActicleCategroy> cacheList = redisCacheUtil.getCacheList("acticleCategroy");
        //判断是否为空
        if (!cacheList.isEmpty()){
            return cacheList;
        }*/
        List<JsActicleCategroy> acticleCategroyList = categroyMapper.getActicleCategroy();
        /*//判断是否为null，不为null添加缓存
        if (acticleCategroyList!=null){
            redisCacheUtil.setCacheList("acticleCategroy",acticleCategroyList);
        }*/
        return acticleCategroyList;
    }
}
